<?php	
class Obj_ObjectType {
	
	protected static $t;
	
	public static function init() {
		self::$t = new Obj_DBTable_ObjectType();
	}
	
	public static function getObjectTypes($activeOnly = false) {
		$ar_ = self::$t->getObjectTypes($activeOnly);
		$ar = array();
		foreach ($ar_ as $k => $v) {
			$ar[$v['ID']] = $v;
		}
		return $ar;
	}
	
	public static function saveObjectType($arData, $id) {
		if ($id == 0) {
			return self::$t->insert($arData);
		}
		else self::$t->update($arData, 'ID = '.intval($id));
		return intval($id);
	}
	
	public static function getObjectType($id) {
		return self::$t->getObjectType($id);
	}
	
	public static function delObjectType($id){
		return self::$t->delete('ID = '.intval($id));
	}
	
}Obj_ObjectType::init();

